//ajax functions html
var	ajax_http_request=new Array();

function makeRequest(url, id, count, do_nothing) {
	if(do_nothing==null || do_nothing==false) {
		setPreContentsAJAX(id);
	}
	
	if(count==null) count = 0;

	ajax_http_request[count]=false;

	if (window.XMLHttpRequest) { // Mozilla, Safari,...
		ajax_http_request[count] = new XMLHttpRequest();
		if (ajax_http_request[count].overrideMimeType) {
			ajax_http_request[count].overrideMimeType('text/html');
		}
	} else if (window.ActiveXObject) { // IE
		try {
			ajax_http_request[count] = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				ajax_http_request[count] = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}

	if (!ajax_http_request[count]) {
		alert('Couldn\'t create ajax_http_request...');
		return false;
	}

	if(do_nothing==null || do_nothing==false) {
		ajax_http_request[count].onreadystatechange = function() { returnContentsAJAX(count, id); };
	}

	ajax_http_request[count].open('GET', url, true);
	ajax_http_request[count].send('');
}	

function setPreContentsAJAX (id) {
	if(document.getElementById(id).innerHTML!=undefined) {
		document.getElementById(id).innerHTML='<div style="padding: 10px; margin: 0px auto 0px auto; width: 20px;"><img src="java/ajax-loader.gif" alt="" /></div>';	
	}
}

function returnContentsAJAX(count, id) {
	if (ajax_http_request[count].readyState == 4) {
		try {
			if (ajax_http_request[count].status == 200) {
				if(document.getElementById(id).value)
					document.getElementById(id).value=''+ajax_http_request[count].responseText+'';
				else {
					document.getElementById(id).innerHTML=""+ajax_http_request[count].responseText+"";
				}
			}
		} catch (e) {
		}
	}
}

function makeRequestSJAX(url, id, do_nothing) {
	if(do_nothing==null || do_nothing==false) {
		setPreContentsAJAX(id);
	}

	http_request=false;

	if (window.XMLHttpRequest) { // Mozilla, Safari,...
		http_request = new XMLHttpRequest();
		if (http_request.overrideMimeType) {
			http_request.overrideMimeType('text/html');
		}
	} else if (window.ActiveXObject) { // IE
		try {
			http_request = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				http_request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}

	if (!http_request) {
		alert('Couldn\'t create http_request...');
		return false;
	}

	http_request.open('GET', url, false);
	http_request.send('');

	if(do_nothing==null || do_nothing==false) {
		if(document.getElementById(id).value)
			document.getElementById(id).value=''+http_request.responseText+'';
		else 
			document.getElementById(id).innerHTML=""+http_request.responseText+"";
	}	
}
